package cn.sangedon.review.data.service.impl;

import cn.sangedon.review.common.domain.data.SpiderMateData;
import cn.sangedon.review.common.service.data.SpiderMateDataService;
import cn.sangedon.review.data.mapper.SpiderMateDataMapper;
import cn.sangedon.review.data.service.ScheduleService;
import cn.sangedon.review.data.spider.ISpiderFactory;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author dongliangqiong
 * @description 针对表【tb_spider_mate_data】的数据库操作Service实现
 * @createDate 2022-08-25 12:41:41
 */
@DubboService
public class SpiderMateDataServiceImpl extends ServiceImpl<SpiderMateDataMapper, SpiderMateData> implements SpiderMateDataService {
    @Autowired
    private ScheduleService scheduleService;

    @Autowired
    private ISpiderFactory spiderFactory;

    @Override
    public List<SpiderMateData> listSpider() {
        return this.list();
    }

    @Override
    public List<SpiderMateData> listSpider(Integer status) {
        return this.baseMapper.listSpider(status);
    }

    @Override
    public void execSpider(Long id) {
        SpiderMateData spiderMateData = this.getById(id);
        spiderFactory.createSpider(spiderMateData).crawlData();
    }
}




